/**************************************************************************************
 *  Copyright (c)  2010  Leszek Karcz.
 *  Permission is granted to copy, distribute and/or modify this document
 *  under the terms of the GNU Free Documentation License, Version 1.3
 *  or any later version published by the Free Software Foundation;
 *  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 *  A copy of the license is included in the section entitled "GNU
 *  Free Documentation License". 
 **************************************************************************************/
package view;
import java.awt.*;
import javax.swing.*;

import data.*;

/**************************************************************************************
 * Author(s): Leszek Karcz
 * This class combines AreaView and StatsView 
 **************************************************************************************/
public class GameplayView extends JLayeredPane
{
	private static final long serialVersionUID = 7479234593500216028L;
	private GameplayGuiBack back;
	private GameplayGuiTop top;
	private AreaView areaView;
	private StatusView statusView;
	private int w,h;
	
	/**************************************************************************************
	 * Author(s): Leszek Karcz
	 * GameplayView constructor
	 **************************************************************************************/
	public GameplayView(GameplayPlayerData gameplayPlayerData, 	Images images)
	{
		this.w=1024;
		this.h=600;
		this.setPreferredSize(new Dimension(this.w, this.h));
		this.setLocation(0, 0);

		// Create GameplayGuiBack
		this.back = new GameplayGuiBack(images);
		// Create GameplayGuiTop
		this.top = new GameplayGuiTop(images);
		// Create AreaView
		this.areaView = new AreaView(gameplayPlayerData, images);
		// Create StatusView
		this.statusView = new StatusView(gameplayPlayerData, images);
		
		// Combine layers
		this.add(this.back, new Integer(0));	
		this.add(this.areaView, new Integer(1));	
		this.add(this.statusView, new Integer(2));	
		this.add(this.top, new Integer(3));	
	}
	
	/**************************************************************************************
	 * Author(s): Leszek Karcz
	 * Refresh View components
	 **************************************************************************************/
	public void refresh()
	{
		this.areaView.repaint();
		this.statusView.repaint();
	}	
}
